/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Graph;

import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author Andrew
 */
public class Bag<T> implements Iterable<Node<T>> {
    private List<Node<T>> nodes;

    public Bag(List<Node<T>> nodes) {
        this.nodes = nodes;
    }

    public Bag() {
        this.nodes = Collections.<Node<T>>emptyList();
    }

    /**
     * Returns the nodes within this bag. This is not
     * copy, thus changes to the list will affect the
     * state of this object.
     *
     * @return - The nodes
     */
    public List<Node<T>> getNodes() {
        return nodes;
    }

    public Iterator<Node<T>> iterator() {
        return nodes.iterator();
    }
}